package com.lucenten.collect.gnss.handler.tools;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class GnssContext {

    public static final Double CSPEED = 2.99792458e+8; //光速:米/秒

    public static final Double F1 = 154.e0 * 10.23e+6;

    public static final Double F2 = 120.e0 * 10.23e+6;
    /** 地球引力常数GM = 3986005e8 m3/s2 **/
    public static final Double GM = 3986005e8;
    //地球椭球长半径a=6378137 m
    public static final Double EARTH_RADIUS = 6378137D;
    /** 地球自转角速度 wo=7292115×10-11 rad/s **/
    public static final Double WO = 7292115e-11;
    public static final Integer INTERVAL = 30;
    // 最低仰角
    public static Double MIN_FILE = 20.0;
    public static Integer[] TK_NUM = new Integer[]{1, -4, 5, 6, 1, -4, 5, 6, -2, -7, 0, -1, -2,-7, 0, -1, 4, -3, 3, 2, 4,-3, 3, 2};
    public static String[] tk_num=new String[]{"x","1","-4","5","6","1","-4","5","6","-2","-7","0","-1","-2","-7","0","-1","4","-3","3","2","4","-3","3","2"};

    //根据观察类型判断是否是双频
    public static final String[] A = {"C1", "P1", "L1", "L2"};
    public static final String[] B = {"C1", "P2", "L1", "L2"};
    public static final List<String> OBS_TYPE_A = new ArrayList<>(Arrays.asList(A));
    public static final List<String> OBS_TYPE_B = new ArrayList<>(Arrays.asList(B));

    //3.02 N文件 参数类型
    public static final String[] AN = {"L1I", "L7I", "C1I", "C7I"};
    public static final String[] BN = {"L1I", "L7I", "C1I", "C7I"};
    public static final List<String> OBS_TYPE_AN = new ArrayList<>(Arrays.asList(AN));
    public static final List<String> OBS_TYPE_BN = new ArrayList<>(Arrays.asList(BN));

    //3.02 C文件 参数类型
    public static final String[] AC = {"L1C", "L2W", "C1C", "C2W"};
    public static final String[] BC = {"L1C", "L2W", "C1C", "C2W"};
    public static final List<String> OBS_TYPE_AC = new ArrayList<>(Arrays.asList(AC));
    public static final List<String> OBS_TYPE_BC = new ArrayList<>(Arrays.asList(BC));

    //3.02 g文件 参数类型
    public static final String[] AG = {"L1C", "L2P", "C1C", "C2P"};
    public static final String[] BG = {"L1C", "L2P", "C1C", "C2P"};
    public static final List<String> OBS_TYPE_AG = new ArrayList<>(Arrays.asList(AG));
    public static final List<String> OBS_TYPE_BG = new ArrayList<>(Arrays.asList(BG));

    /** 时间吗 */
    public final static String[] TIME_CODE = new String[]{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x"};
    /**
     * 小时转换
     *
     * @param hour
     * @return
     */
    public static Integer convertHour(String hour) {
        for (int i = 0; i < TIME_CODE.length; i ++) {
            if (TIME_CODE[i].equalsIgnoreCase(hour)) {
                return i;
            }
        }
        return -1;
    }

    /**
     * 支持的后缀名
     */
    public static String[] ZIP_EXTS = new String[]{"d.z",".zip",".t02"};

    /**
     * 验证是否需要处理
     *
     * @param fileName
     * @return
     */
    public static boolean isZipExt(String fileName) {
        for (String ext : ZIP_EXTS) {
            if (fileName.toLowerCase().endsWith(ext)) {
                return true;
            }
        }
        return false;
    }

    // 允许中断的时长(120秒,2分钟)
    public final static long MIN_DIF_FERENCE = 2 * 60;

    // 允许两个斜TEC的最大差值
    public final static int POOR_VALUE = 5;

    // 一个链路上的最少数据量,即低于这个量级的数据直接忽略
    public final static int LINK_DATA_NUM = 8;
}
